//
//  MovieCollectionCell.m
//  UI豆瓣2
//
//  Created by dllo on 15/11/6.
//  Copyright © 2015年 蓝鸥科技. All rights reserved.
//

#import "MovieCollectionCell.h"
#import "Movie.h"
#import "UIImageView+WebCache.h"
@implementation MovieCollectionCell

-(instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        [self createMovieCollection];
    }
    return self;
}
- (void)dealloc
{
    [_nameL release];
    [_imageV release];
    [super dealloc];
}

- (void)createMovieCollection{
    
    self.imageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, 140)];
    self.imageV.userInteractionEnabled = YES;
    [self.contentView addSubview:self.imageV];
    [_imageV release];
    
    self.nameL = [[UILabel alloc] initWithFrame:CGRectMake(0, self.imageV.frame.size.height + 5, self.imageV.frame.size.width, 30)];
    //    self.nameL.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.nameL];
    [_nameL release];
    
}

- (void)setMovie:(Movie *)movie{
    if (_movie != movie) {
        [_movie release];
        _movie = [movie retain];
    }
    NSURL *url = [NSURL URLWithString:self.movie.pic_url];
    [self.imageV sd_setImageWithURL:url placeholderImage:[UIImage imageNamed:@"picholder.png"]];
    self.nameL.text = self.movie.movieName;
}

@end
